[#escape x as x?html]
<!DOCTYPE html>
<html>
<head>
    [#include "/include/meta.ftl" /]
    [#include "/include/css.ftl" /]
    <title>附件</title>
    [#include "/include/js.ftl" /]
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <div class="content-wrapper margin-left0">
        [#assign firstNavName="附件"]
        [#assign secondNavName="编辑"]
        [#include "/include/contentHeader.ftl" /]

        <section class="content">
            <div class="box box-success">
                <form id="form" action="${base}/admin/file/update" method="post" class="form-horizontal">
                    <input type="hidden" name="fileId" id="fileId" value="${file.id}">
                    <input type="hidden" name="originName" value="${file.originName}">
                    <input type="hidden" name="id" value="${file.id}"/>
                    <div class="box-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">标题</label>
                            <div class="col-sm-6">
                                <input type="text" name="name" value="${file.name}" class="form-control" placeholder="标题">
                            </div>
                        </div>
                    </div>

                    <div class="box-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">分类</label>
                            <div class="col-sm-6">
                                [#list fileClasses as fileClass]
                                    <label>
                                        <input name="fileClassId" type="radio" value="${fileClass.id}"
                                               [#if file.fileClass.id == fileClass.id]checked=""[/#if]>
                                    ${fileClass.name}
                                    </label>
                                [/#list]

                            [#--<div class="checkbox">
                                <label>
                                    <input type="checkbox" disabled="">
                                    Checkbox disabled
                                </label>
                            </div>--]
                            </div>
                        </div>
                    </div>

                    <div class="box-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">新文件</label>
                            <div class="col-sm-6" id="uploadFile">
                                <input type="file" name="file" id="file">
                            </div>
                        </div>
                        <div class="form-group" id="uploadedFile">
                            <label class="col-sm-2 control-label">已传</label>
                            <div class="col-sm-5">
                                <span>${file.originName}</span>
                            </div>
                            <div class="col-sm-1">
                                <button id="downloadFile" type="button"
                                        class="btn btn-block btn-info"  style="display: [#if file.originName??]block[#else]none[/#if]">下载
                                </button>
                            </div>
                        </div>
                    </div>


                    <div class="box-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否显示</label>
                            <div class="col-sm-6">
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="display" value="true" [#if file.display]checked=""[/#if]>是
                                    </label>
                                    &nbsp;&nbsp;
                                    <label>
                                        <input type="radio" name="display" value="false" [#if !file.display]checked=""[/#if]>否
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="box-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否置顶</label>
                            <div class="col-sm-6">
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="top" value="true" [#if file.top]checked=""[/#if]>是
                                    </label>
                                    &nbsp;&nbsp;
                                    <label>
                                        <input type="radio" name="top" value="false" [#if !file.top]checked=""[/#if]>否
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>


                    <div class="box-footer">
                        <div class="row">
                            <div class="col-sm-offset-2">
                                <button id="btnSubmit" type="button" class="btn btn-primary">保存</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </section>
    </div>

</div>
<!-- ./wrapper -->
<script type="text/javascript">
    require([ 'admin/js/file/add' ], function(Page) {
        Page.main();
    });
</script>
</body>
</html>
[/#escape]
